
<?php 
$showForm = true;
if ($resource['projectSid'] != NULL) {
	$projectMemberType = isset($projectMember) ? $projectMember->type : NULL;
	if (!Util_Data::containsString( array('owner','admin','collab'), $projectMemberType))
		$showForm = false;
}
?>

<?php if ($showForm) {?>
							<form class="form-horizontal" id="FormResource" name="FormResource" action="<?php echo controller_base_path($requestContext); ?>/Resource/new/form" method="post" enctype="multipart/form-data"  >
								<input type="hidden" id="domainId" name="domainId" value="<?php echo Util_Data::getValueOf($resource, 'domainId'); ?>" />
								<input type="hidden" id="return_url" name="return_url" value="<?php echo $return_url; ?>" />
<?php if ($resource['projectSid'] != NULL) {?>
								<input type="hidden" id="projectSid" name="projectSid" value="<?php echo Util_Data::getValueOf($resource, 'projectSid'); ?>" />
<?php } ?>
								<fieldset>
									<legend>New Resource</legend>
									<div class="control-group">
										<label class="control-label" for="name">Name</label>
										<div class="controls">
											<input type="text" id="title" name="title" class="required"
												value="<?php echo Util_Data::getValueOf($resource, 'title'); ?>" />
										</div>
									</div>
									<div class="control-group" >
										<label class="control-label" for="file">File</label>
										<div class="controls">
											<input type="file" id="file" name="file" />
										</div>
									</div>
									<div class="control-group">
										<label class="control-label" for="description">Description</label>
										<div class="controls">
											<textarea id="description" name="description" ><?php echo Util_Data::getValueOf($resource, 'description'); ?></textarea>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label" for="categorySid">Category</label>
										<div class="controls">
											<?php echo Form::select('categorySid', $ref_categories, Util_Data::getValueOf($resource, 'categorySid')); ?>
										</div>
									</div>
									
									<div class="control-group">
										<div class="controls">
											<button type="submit" class="btn">Add</button>
										</div>
									</div>
								</fieldset>
							</form>
<?php } ?>
							<!-- STREAMS -->
							<h6>Resources</h6>
							<table class="table">
								<thead>
									<tr>
										<th>Title</th>
										<th>&nbsp;</th>
										<th>Description</th>
										<th>Owner</th>
										<!--<th>Goal</th>-->
										<th>Created</th>
										<th>Modified</th>
									</tr>
								</thead>
								<tbody>
<?php foreach ($resources as $resource) { ?>
									<tr>
										<td><?php echo Util_Data::getValueOf($resource, 'title'); ?></td>
										<td title="<?php echo Util_Data::getValueOf($resource, 'fileName').' ['.Util_Data::getValueOf($resource, 'fileSize').'b]'; ?>"><a href="<?php echo resource_file_url($resource) ?>"><?php if ($resource->fileSize > 0){ echo '<i class="icon-download-alt"></i>'; } ?></a></td>
										<td><?php echo Util_Data::getValueOf($resource, 'description'); ?></td>
										<td><?php echo Util_Data::getValueOf($resource, 'creatorDisplayName'); ?></td>
										<!--<td><?php echo Util_Data::getValueOf($resource, 'projectName'); ?></td>-->
										<td><?php echo Util_Datetime::format_convert(Util_Data::getValueOf($resource, 'createDt'), Util_Datetime::FORMAT_DATE_ISO, $sessionInfo->userInfo['dateFormat']); ?></td>
										<td><?php echo Util_Datetime::format_convert(Util_Data::getValueOf($resource, 'lastModifiedDt'), Util_Datetime::FORMAT_DATE_ISO, $sessionInfo->userInfo['dateFormat']); ?></td>
									</tr>
<?php } ?>
								</tbody>
							</table>
							
